Template.messages_chatroom_list_item.onRendered(function () {
  let itemSum = Session.get('class.messages.renderedItemSum');
  ++itemSum;

  Session.set('class.messages.renderedItemSum', itemSum);
});

Template.messages_chatroom_list_item.helpers({
  isCurrent: function () {
    return Template.instance().data.result.sender === Meteor.userId();
  },

  time: function () {
    return Template.instance().data.result.createdAt
  },

  showTime: function() {
    return Template.instance().data.result.showTime;
  },
});

Template.messages_chatroom_list_item.events({
  'click .delete-message' (e, instance) {
    Session.set('class.messages.messagesNotice.open', true);
    Session.set('class.messages.messagesNotice.type', 'delete-message');
    Session.set('class.messages.messagesNotice.id', instance.data.result._id);
  },

});